package com.erp.web.controller.system;

import com.erp.framework.core.controller.BaseController;
import com.erp.framework.core.page.TableDataInfo;
import com.erp.system.domain.PurchaseOrder;
import com.erp.system.service.PurchaseOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * FileName: PurchaseOrderController.java
 * SpringMVC控制器的详细说明
 *
 * @version 1.00
 * @Date 创建日期
 */

@Controller
@RequestMapping("/system/purchaseOrder")
public class PurchaseOrderController extends BaseController {

    @Autowired
    private PurchaseOrderService purchaseOrderService;

    private String prefix = "system/purchaseOrder";

    @RequiresPermissions("system:purchaseOrder:view")
    @GetMapping()
    public String config() {
        return prefix + "/purchaseOrder";
    }

    @RequiresPermissions("system:approval:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PurchaseOrder purchaseOrder) {
        startPage();
        List<PurchaseOrder> list = purchaseOrderService.queryAll(purchaseOrder);
        return getDataTable(list);
    }
}
